import { Chessman } from "./Chessman";

export default class ChessGuards extends Chessman {
  constructor(chessName, camp, x, y, key, chessId) {
    super(chessName, camp, x, y, key, chessId);
  }
  predictionMove(chessList, path?) {
    const res = [];
    const temp = [];
    temp.push(
      ...[
        [this.x + 1, this.y - 1],
        [this.x - 1, this.y - 1],
        [this.x + 1, this.y + 1],
        [this.x - 1, this.y + 1],
      ]
    );

    if (this.x === 3) {
      temp[1] = null;
      temp[3] = null;
    } else if (this.x === 5) {
      temp[0] = null;
      temp[2] = null;
    }
    if (this.y === 9) {
      temp[2] = null;
      temp[3] = null;
    }
    if (this.y === 0) {
      temp[0] = null;
      temp[1] = null;
    }
    res.push(...this.filterChessman(temp, [...chessList]));
    return { data: this, path: res };
  }
}
